<?php

class Test_mail_reading extends CI_Controller {

	public function __construct() {
            parent::__construct(); 

	}
        
        public function index() {

echo "</br>Test mail reading!</br>";

		$my_family = '14';

		$query = $this -> doctrine -> em -> createQuery ("SELECT a, b.msgText, b.fromUser, b.importance, b.msgType FROM ORM\Dynasties2\Maillinks a JOIN a.msgId b WHERE a.toUser = $my_family");

		$result = $query->getResult();
             //print_r($result);
		// \Doctrine\Common\Util\Debug::dump($result);

		foreach ($result as $val1 => $val2) {
		//echo $val2;
			foreach ($val2 as $val3 => $val4) {
				if ($val3 != '0') {
				echo "col " . $val3 . " is:  ";
				echo $val4;
				echo ";   ";
				//echo firstname + " " + lastname;
				}
			}
			echo "</br>";

		}

/*
		foreach ($result as $val => $val2) {
	//print_r($val2);
	//echo $val2;



		foreach ($val2 as $col => $val3) {
			//print_r($val3);
			//echo ($val3);
			$data = $val3;
			if ($col === 'fromUser') {
			echo "</br>My data is " . $data;
			}
		}
*/



	}
}